import React from 'react';
import { createRoot } from 'react-dom/client';
import { AppContent } from '@tmagic/ui-react';
import App from './App';
import { app } from './main';

export const renderDom = () => {
  const domNode = document.getElementById('root');
  const root = createRoot(domNode);
  root.render(
    <>
      <AppContent.Provider value={app}>
        <App />
      </AppContent.Provider>
    </>
  );

  setTimeout(() => {
    // @ts-ignore
    window.magic.onPageElUpdate(document.querySelector('.magic-ui-page'));
  });
};
